package com.aaa.home.controller;

import com.aaa.common.vo.Result;
import com.aaa.home.service.TbHeadNavService;
import com.aaa.home.vo.HeadNavkVo;
import com.aaa.home.vo.LinkVo;
import com.aaa.home.vo.Zone.HeadNavAddVo;
import com.aaa.home.vo.ZoneAddVo;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author ：Mickey
 * @date ：Created in 2022/12/8 1:28
 * @description：
 * @modified By：
 * @version:
 */
@RestController
@RequestMapping("/home/head")
@Api(tags = "头部导航接口类")
public class TbHeadNavController {

    @Autowired
    private TbHeadNavService headNavService;

    //查询所有链接并且分页加条件查询
    @PostMapping("/getAllHeadNav/{current}/{pageSize}")
    public Result findLinkByPage(@RequestBody HeadNavkVo headNavkVo,
                                 @PathVariable Integer current,
                                 @PathVariable Integer pageSize
    ){
        return headNavService.getAllHeadNavPage(headNavkVo,current,pageSize);
    }

    //改变专区状态
    @PostMapping("/changeStatus/{headId}/{isDisable}")
    public Result updateZoneStatus(@PathVariable String headId,
                                   @PathVariable String isDisable){

        return headNavService.updateheadNavStatus(headId,isDisable);
    }

    //删除专区
    @PostMapping("/deleteHeadNav/{headId}")
    public Result deleteZoneById(@PathVariable String headId){
        System.out.println("删除头部导航"+headId);
        return headNavService.deleteheadNavBtId(headId);
    }

    //添加专区
    @PostMapping("/addHeadNav")
    public Result addZone(@RequestBody HeadNavAddVo headNavAddVo){
        return headNavService.addHeadNav(headNavAddVo);
    }
}
